#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<graphics.h>
int main()
{
	float Pi=3.1415926;//圆周率
	initgraph(1200,900);//打开一个600*600的窗口
	setbkcolor(RGB(128,128,128));//设置背景颜色为灰色
	cleardevice();//以背景颜色清空画布

	int centerX,centerY,r;//圆心坐标和半径

	while(1)//一直死循环
	{
		for(centerX=150;centerX<1200;centerX=centerX+300)
		{
			for(centerY=150;centerY<800;centerY=centerY+300)
			{
				int i;
				float offset,tf=0;
				float h = rand()%180;
				COLORREF color1 = HSVtoRGB(h,0.9,0.8);
				COLORREF color2 = HSVtoRGB(h+180,0.9,0.8);
				for(r=150;r>0;r=r-30)
				{
					int left = centerX-r;
					int right = centerX+r;
					int top = centerY-r;
					int bottom = centerY+r;

					for(i=0;i<20;i++)
					{
						offset = i*Pi/10+tf;
						setfillcolor(color1);//设置填充颜色1的扇形
						solidpie(left,top,right,bottom,offset,2*Pi/60+offset);
						setfillcolor(RGB(255,255,255));//设置填充颜色为白色的扇形
						solidpie(left,top,right,bottom,2*Pi/60+offset,3*Pi/60+offset);
						setfillcolor(color2);//设置填充颜色2的扇形
						solidpie(left,top,right,bottom,3*Pi/60+offset,5*Pi/60+offset);
						setfillcolor(RGB(0,0,0));//设置填充颜色为黑色的扇形
						solidpie(left,top,right,bottom,5*Pi/60+offset,6*Pi/60+offset);
					}
					tf=tf+Pi/20;
				}
			}
		}
		_getch();
	}
	system("pause");
	return 0;
}